using System;

namespace ACS.Compiler.Tables.Modes
{
    public class ArrayMode : ContainerMode
    {
        public override bool Equals(object obj)
        {
            ArrayMode m = obj as ArrayMode;
            if (m != null)
            {
                return m.Mode.Equals(Mode);
            } 
            Array1Mode m1 = obj as Array1Mode;
            if (m1 != null)
            {
                return m1.Mode.Equals(Mode);
            } 
            return false;
        }

        private StructMode _mode;
        private int _occurs;

        public ArrayMode(StructMode mode, int occurs)
        {
            _mode = mode;
            _occurs = occurs;
        }

        public override StructMode Mode
        {
            get { return _mode; }
        }

        public int Occurs
        {
            get { return _occurs; }
        }

        public override string ToDeclareFormat()
        {
            return String.Format("ArrayType<{0}>", Mode.ToDeclareFormat());
        }
    }
}